<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.util.Arrays" %>
<%@include file="/public.jsp"%><%--
  Created by IntelliJ IDEA.
  User: Yzk20
  Date: 2025/7/1
  Time: 8:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
  <title>Title</title>
  <link rel="stylesheet" type="text/css" href="css/styless.css">
</head>
<body>
<form>
  <%
    String user_id=request.getParameter("user_id");
    Statement stmt=conn.createStatement();
    String sql="SELECT * FROM user t WHERE " +" 1=1 ";
    if(null!=user_id){
      sql=sql+" AND  t.user_id LIKE '%"+user_id+"%' ";
    }

    ResultSet rs=stmt.executeQuery(sql);
    String user="admin";
    request.setAttribute("t",user);
  %>
  <%--    <table align="center" >--%>
  <%--        <tr>--%>
  <%--            <td>图书名称：<input type="text" name="bookName" id="bookName"></td>--%>
  <%--        </tr>--%>
  <%--        <tr>--%>
  <%--            <td align="center" >--%>
  <%--                <input type="hidden" name="actionType" value="book">--%>
  <%--                <input type="submit" value="查询" >--%>
  <%--                <input type="button" value="添加" onclick="book_add()">--%>
  <%--            </td>--%>
  <%--        </tr>--%>
  <%--    </table>--%>
  <%--    <hr>--%>

  <table align="center" width="80%" berder="1" >
    <h1 align="center">欢迎进入账号信息</h1>
    <tr>
      <td>用户ID</td>
      <td>用户账号</td>
      <td>用户密码</td>
      <td>电子邮箱</td>
      <td>操作</td>
    </tr>
    <tbody id="devList">
    <tr>
        <%
    while(rs.next()) {
%>
    <tr>
      <td><%=rs.getString("user_id")%></td>
      <td><%=rs.getString("login_account")%></td>
      <td><%=rs.getString("login_pwd")%></td>
      <td><%=rs.getString("email")%></td>
      <%--            <td><%=rs.getString("date")%></td>--%>
      <%--            <td><%=rs.getString("status")%></td>--%>
      <td>
      <input type="button" value="修改" onclick="accout_update(<%=rs.getString("user_id")%>)">
      <input type="button" value="删除" onclick="accout_delete(<%=rs.getString("user_id")%>)">
      </td>
      <%}%>

    </tr>
    </tbody>
  </table>
</form>
<script>
    // function book_add(){
    //
    //     window.location.href = "book/book_add.jsp"
    // }
    function accout_update(user_id){
        window.location.href = "accout/accout_update.jsp?user_id="+ user_id;
    }
    function accout_delete(user_id){
        window.location.href = "accout/accout_delete.jsp?user_id="+ user_id;
    }
</script>
</from>
</body>
</html>
